package leetcode.array;

import java.util.List;

import leetcode.linkedlist.model.ListNode;

public class ConvertToLinked {
    public static ListNode convertToSingleLinked(List<Integer> arr) {
        if (arr == null || arr.isEmpty()) {
            return null;
        }
        ListNode head = new ListNode(arr.get(0));
        ListNode cur = head;
        for (int i = 1; i < arr.size(); i++) {
            cur.next = new ListNode(arr.get(i));
            cur = cur.next;
        }
        return head;
    }
}
